<div class="row-fluid">
    <div class="span12">
        <!-- BEGIN THEME CUSTOMIZER-->

        <!-- END THEME CUSTOMIZER-->
        <!-- BEGIN PAGE TITLE & BREADCRUMB-->
        <div style="clear:both; height:20px"></div>
        <ul class="breadcrumb">
            <li>
                <a href="<?php echo $this->Html->url(array("controller" => "home", "action" => "index")); ?>">Home</a>
                <span class="divider">/</span>
            </li>
<!--             <li class="active"> -->
<!--                <a href="<?php //echo $this->Html->url(array("controller" => "home", "action" => "master")); ?>">マスター</a>-->
<!--                 <span class="divider">/</span> -->
<!--             </li> -->
            <li class="active">録画機能

            </li>
           
        </ul>
        <!-- END PAGE TITLE & BREADCRUMB-->
        <div class="row-fluid">
            <div class="span12">

                <div style="margin:0px 0px 20px 0px">
                        <h3 style="margin:0px">サーバー情報</h3>
                        <div><div style="width:150px; float: left; font-weight: bold;">サーバーIP</div>: <?php echo $_SERVER['HTTP_HOST'];?></div>
                        <div><div style="width:150px; float: left; font-weight: bold;">総容量</div>: <?php echo round(disk_total_space(ROOT)/(1024*1024*1024));?>GB</div>
                        <div><div style="width:150px; float: left; font-weight: bold;">空き容量</div>: <?php echo round(disk_free_space(ROOT)/(1024*1024*1024));?>GB</div>
                    </div>
                <!-- BEGIN EXAMPLE TABLE widget-->

                <div class="control-group">
                    <?php echo $this->Form->create('Camera', array(
                            'inputDefaults' => array(
                                    'div' => 'control-group',
                                    'label' => array(
                                            'class' => 'control-label'
                                    ),
                                    'wrapInput' => 'controls'
                            ),
                            'class' => 'form-horizontal'
                    )); 
                    ?>
                    <?php 
                        echo $this->Form->input('Camera.CustId', array(
                            'label' => array(
                                    'text' => 'お客様名'
                            ),
                            'empty' => false,
                            'options' => $this->Common->listCustomer(true),
                            'class' => 'span4',
                            'id' => 'search_customer'
                    )); 
                    ?>
                    <?php 
                        echo $this->Form->input('Camera.BuildId', array(
                            'label' => array(
                                    'text' => '物件名'
                            ),
                            'empty' => false,
                            'options' => $this->Common->listBulding(),
                            'class' => 'span4',
                            'id' => 'search_building'
                    )); 
                    ?>
                    <?php 
                    echo $this->Form->input('Camera.CamName', array(
                            'placeholder' => 'カメラ名',
                             'label' => array(
                                    'text' => 'カメラ名'
                            ),
                            'class' => 'span4',
                            'type' => 'text',
                            'required' => false
                    )); 
                    ?>
                    <div class="control-group required">
                        <label for="CameraName" class="control-label">
                            <button class="btn btn-success" type="submit">
                                <i class="icon-ok icon-white"></i> 検索
                            </button>
                        </label>
                        <div class="controls required">
                        </div>
                    </div>
                    <?php echo $this->Form->end(); ?>
                    
                </div>
                <div class="widget orange">
                    <div class="widget-title">
                        <h4><i class="icon-reorder"></i> 録画機能</h4>
                        <span class="tools">
                            <a href="javascript:;" class="icon-chevron-down"></a>

                        </span>
                    </div>
                    <div class="widget-body">
                        <table class="table table-striped table-bordered" id="sample_1">
                            <thead>
                                <tr>
                                    <th class="text-center">カメラID</th>
                                    <th >カメラ名</th>
                                    <th >お客様名</th>
                                    <th >物件名</th>
                                    <th style="width: 130px"></th>
                                    <th style="width: 80px"></th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php foreach($cameras as $camera):?>
                                <tr class="odd gradeX">
                                    <td class="text-center"><?php echo $camera['Camera']['CamID']?></td>
                                    <td><?php echo $camera['Camera']['CamName']?></td>
                                    <td><?php echo $camera['Customer']['CustName']?></td>
                                    <td><?php echo $camera['Building']['BuildName']?></td>
                                    <td>
                                        <button class="btn  btn-success start_camera <?php echo $camera['Camera']['is_start']==1?"hideField":""?>" type="button" data-id="<?php echo $camera['Camera']['Id']?>"><i class="icon-plus icon-white"></i> 開始</button>
                                        <button class="btn  btn-danger stop_camera <?php echo $camera['Camera']['is_start']==0?"hideField":""?>" type="button" data-id="<?php echo $camera['Camera']['Id']?>"><i class="icon-remove icon-white"></i> 停止</button>
                                    </td>
                                    <td>
                                        <div  style="margin-top:3px"><i class="icon-map-marker"></i> 
                                            <a data-id="<?php echo $camera['Camera']['Id']?>" class="view_file">View File</a>
                                        </div>
                                    </td>
                                    
                                </tr>
                                <?php endforeach;?>
                                
                            </tbody>
                        </table>
                    </div>
                </div>
                <!-- END EXAMPLE TABLE widget-->


            </div>
        </div>
    </div>
</div>
<div style="display:none" id="container_record">
</div>
<script>
$(document).ready(function(){
    //
    
    if($("#search_customer").size() > 0){
        getBuilding('<?php echo isset($_REQUEST['data']['Camera']['BuildId'])?$_REQUEST['data']['Camera']['BuildId']:"-1"?>',0);
    }
    $("#search_customer").on('change',function(){
        getBuilding(-1,0);
    });
    
});
</script>